package br.com.kliptus.model.bean;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.maverick.bean.EntityBean;

@Entity
@Table(name = "entity")
public class EntityJB extends EntityBean {

	private static final long serialVersionUID = 1L;

	private String name;
	private String cpf;
	private String rg;

	private String corporateName;
	private String fantasyName;
	private String cnpj;
	private String responsible;

	private EntityTypeJB entityType;
	private AddressJB address;
	private ContactJB contact;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id")
	public Long getId() {
		return id;
	}

	@Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "cpf")
	public String getCpf() {
		return cpf;
	}

	public void setCpf(String cpf) {
		this.cpf = cpf;
	}

	@Column(name = "rg")
	public String getRg() {
		return rg;
	}

	public void setRg(String rg) {
		this.rg = rg;
	}

	@Column(name = "corporate_name")
	public String getCorporateName() {
		return corporateName;
	}

	public void setCorporateName(String corporateName) {
		this.corporateName = corporateName;
	}

	@Column(name = "fantasy_name")
	public String getFantasyName() {
		return fantasyName;
	}

	public void setFantasyName(String fantasyName) {
		this.fantasyName = fantasyName;
	}

	@Column(name = "cnpj")
	public String getCnpj() {
		return cnpj;
	}

	public void setCnpj(String cnpj) {
		this.cnpj = cnpj;
	}

	@Column(name = "responsible")
	public String getResponsible() {
		return responsible;
	}

	public void setResponsible(String responsible) {
		this.responsible = responsible;
	}

	@ManyToOne
	@JoinColumn(name = "entity_type_id", referencedColumnName = "id")
	public EntityTypeJB getEntityType() {
		return entityType;
	}

	public void setEntityType(EntityTypeJB entityType) {
		this.entityType = entityType;
	}

	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "address_id")
	public AddressJB getAddress() {
		return address;
	}

	public void setAddress(AddressJB address) {
		this.address = address;
	}

	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "contact_id")
	public ContactJB getContact() {
		return contact;
	}

	public void setContact(ContactJB contact) {
		this.contact = contact;
	}

}